package com.cloud.user.controller;


import com.cloud.common.entity.ShopOrder;
import com.cloud.user.service.ShopUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 购物用户 前端控制器
 * </p>
 *
 * @author 李均华
 * @since 2021-06-04
 */
@RestController
@RequestMapping("/shop/user")
public class ShopUserController {

    @Autowired
    private ShopUserService shopUserService;

    /**
     * 测试接口
     * @return
     */
    @GetMapping("/test")
    public String test(){
        return "test";
    }

    /**
     * 用户下单
     * @param id 商品id
     * @param num 商品数量
     * @return
     */
    @GetMapping("/order/{id}/{num}")
    public ShopOrder order(@PathVariable("id") Integer id,@PathVariable("num")  Integer num) {
        return shopUserService.order(id,num);
    }

}

